<template>
<div>
  <el-swiper :list="swiper" />
  <div v-for="item of list"
       :key="item.id">
    <van-card
        :title="`${item.patientName}  ${item.patientSex} ${item.patientAge}岁`"
        :thumb="item.picCover"
        @click="todetail(item)"
    >
      <template #tags>
        <p>{{`已上课时|${item.courseTime}`}}</p>
        <p>临床诊断|{{ item.clinicalDiagnosis }}</p>
      </template>
      <template #footer>
        <van-button size="mini">阅读更多</van-button>
      </template>
    </van-card>
  </div>
</div>
</template>

<script>
import { getAnli } from "@/api/anli";
import {getSwiper} from "@/api/swiper";

export default {
  name: "anli",
  data() {
    return {
      total:0,
      current:1,
      list:[],
      swiper:[]
    }
  },
  created() {
    this.getList()
    getSwiper(8).then(({records})=>{
      this.swiper = records
    })
  },
  methods: {
    async getList(){
      const res = await getAnli(this.current)
      console.log(res.records)
      this.list = this.list.concat(res.records)
      this.total = res.total
      this.current = res.current
    },
    todetail(item){
      localStorage.setItem('anlidetail',JSON.stringify(item))
      this.$router.push('/adetail')
    }
  }
}
</script>

<style scoped>
>>>.van-card__thumb{
  width: 120px;
  height: 120px;
}
>>>.van-card__content{
  line-height: 40px;
  font-size: 16px;
}
>>>.van-card__title{
  line-height: normal;
}
</style>
